/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('aps', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model GetFxCustomerTypeRequest {
  uid?: long(name='Uid'),
}

model GetFxCustomerTypeResponseBody = {
  code?: string(name='Code'),
  data?: {
    customerType?: int32(name='CustomerType'),
    isSub?: int32(name='IsSub'),
    parentId?: long(name='ParentId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetFxCustomerTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFxCustomerTypeResponseBody(name='body'),
}

async function getFxCustomerTypeWithOptions(request: GetFxCustomerTypeRequest, runtime: Util.RuntimeOptions): GetFxCustomerTypeResponse {
  Util.validateModel(request);
  var query = {};
  if (!Util.isUnset(request.uid)) {
    query['Uid'] = request.uid;
  }
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetFxCustomerType',
    version = '2024-03-25',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getFxCustomerType(request: GetFxCustomerTypeRequest): GetFxCustomerTypeResponse {
  var runtime = new Util.RuntimeOptions{};
  return getFxCustomerTypeWithOptions(request, runtime);
}

